package reflect;

import java.lang.reflect.Method;
import java.net.URL;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;

public class ReflectTest {
    public static void main(String[] args) {
        try {
            Class aClass = Class.forName("reflect.Reflect");
            Class reflectClass = Reflect.class;

            try {
                Method methods = aClass.getMethod("getMethods");
                System.out.println(methods);
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        ReflectUtil reflectUtil = new ReflectUtil();
        reflectUtil.react("reflect.Reflect","sleep");

        ClassLoader loader = ReflectUtil.class.getClassLoader();
        URL resource = loader.getResource("application.properties");
        Properties properties = reflectUtil.getProperties(resource.toString());
        Set<String> strings = properties.stringPropertyNames();
        for(String s:strings){
            System.out.println(s+":"+properties.getProperty(s));
        }
    }

}
